home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / DatabaseAccess.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  12.9 KB  |  465 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DatabaseAccess.a
  3. ;
  4. ;    Contains:    Database Access Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1989-1998, 1995-1997 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__DATABASEACCESS__') = 'UNDEFINED' THEN
  19. __DATABASEACCESS__ SET 1
  20.  
  21.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  22.     include 'Resources.a'
  23.     ENDIF
  24.  
  25. ;  data type codes 
  26.  
  27. typeNone                        EQU        'none'
  28. typeDate                        EQU        'date'
  29. typeTime                        EQU        'time'
  30. typeTimeStamp                    EQU        'tims'
  31. typeDecimal                        EQU        'deci'
  32. typeMoney                        EQU        'mone'
  33. typeVChar                        EQU        'vcha'
  34. typeVBin                        EQU        'vbin'
  35. typeLChar                        EQU        'lcha'
  36. typeLBin                        EQU        'lbin'
  37. typeDiscard                        EQU        'disc'                ; "dummy" types for DBResultsToText 
  38. typeUnknown                        EQU        'unkn'
  39. typeColBreak                    EQU        'colb'
  40. typeRowBreak                    EQU        'rowb'                ; pass this in to DBGetItem for any data type 
  41. typeAnyType                        EQU        0
  42. ;  infinite timeout value for DBGetItem 
  43.  
  44.                                                             ; messages for status functions for DBStartQuery 
  45. kDBUpdateWind                    EQU        0
  46. kDBAboutToInit                    EQU        1
  47. kDBInitComplete                    EQU        2
  48. kDBSendComplete                    EQU        3
  49. kDBExecComplete                    EQU        4
  50. kDBStartQueryComplete            EQU        5
  51.  
  52.                                                             ; messages for status functions for DBGetQueryResults 
  53. kDBGetItemComplete                EQU        6
  54. kDBGetQueryResultsComplete        EQU        7
  55. kDBWaitForever                    EQU        -1
  56.  
  57.                                                             ;  flags for DBGetItem  
  58. kDBLastColFlag                    EQU        $0001
  59. kDBNullFlag                        EQU        $0004
  60. ; typedef OSType                         DBType
  61.  
  62.  
  63.  
  64. ; typedef DBAsyncParamBlockRec *        DBAsyncParmBlkPtr
  65.  
  66. ;  structure for asynchronous parameter block 
  67. DBAsyncParamBlockRec    RECORD 0
  68. completionProc             ds.l    1                ; offset: $0 (0)        ;  pointer to completion routine 
  69. result                     ds.w    1                ; offset: $4 (4)        ;  result of call 
  70. userRef                     ds.l    1                ; offset: $6 (6)        ;  for application's use 
  71. ddevRef                     ds.l    1                ; offset: $A (10)        ;  for ddev's use 
  72. reserved                 ds.l    1                ; offset: $E (14)        ;  for internal use 
  73. sizeof                     EQU *                    ; size:   $12 (18)
  74.                         ENDR
  75. ;  structure for resource list in QueryRecord 
  76. ResListElem                RECORD 0
  77. theType                     ds.l    1                ; offset: $0 (0)        ;  resource type 
  78. id                         ds.w    1                ; offset: $4 (4)        ;  resource id 
  79. sizeof                     EQU *                    ; size:   $6 (6)
  80.                         ENDR
  81. ; typedef struct ResListElem *            ResListPtr
  82.  
  83. ; typedef ResListPtr *                    ResListHandle
  84.  
  85. ;  structure for query list in QueryRecord 
  86. QueryArray                RECORD 0
  87. elements                 ds.l    256
  88. sizeof                     EQU *                    ; size:   $400 (1024)
  89.                         ENDR
  90.  
  91.  
  92. QueryRecord                RECORD 0
  93. version                     ds.w    1                ; offset: $0 (0)        ;  version 
  94. id                         ds.w    1                ; offset: $2 (2)        ;  id of 'qrsc' this came from 
  95. queryProc                 ds.l    1                ; offset: $4 (4)        ;  handle to query def proc 
  96. ddevName                 ds        Str63            ; offset: $8 (8)        ;  ddev name 
  97. host                     ds        Str255            ; offset: $48 (72)        ;  host name 
  98. user                     ds        Str255            ; offset: $148 (328)    ;  user name 
  99. password                 ds        Str255            ; offset: $248 (584)    ;  password 
  100. connStr                     ds        Str255            ; offset: $348 (840)    ;  connection string 
  101. currQuery                 ds.w    1                ; offset: $448 (1096)    ;  index of current query 
  102. numQueries                 ds.w    1                ; offset: $44A (1098)    ;  number of queries in list 
  103. queryList                 ds.l    1                ; offset: $44C (1100)    ;  handle to array of handles to text 
  104. numRes                     ds.w    1                ; offset: $450 (1104)    ;  number of resources in list 
  105. resList                     ds.l    1                ; offset: $452 (1106)    ;  handle to array of resource list elements 
  106. dataHandle                 ds.l    1                ; offset: $456 (1110)    ;  for use by query def proc 
  107. refCon                     ds.l    1                ; offset: $45A (1114)    ;  for use by application 
  108. sizeof                     EQU *                    ; size:   $45E (1118)
  109.                         ENDR
  110. ; typedef struct QueryRecord *            QueryPtr
  111.  
  112. ; typedef QueryPtr *                    QueryHandle
  113.  
  114. ;  structure of column types array in ResultsRecord 
  115. ColTypesArray            RECORD 0
  116. elements                 ds.l    256
  117. sizeof                     EQU *                    ; size:   $400 (1024)
  118.                         ENDR
  119.  
  120.  
  121. ;  structure for column info in ResultsRecord 
  122. DBColInfoRecord            RECORD 0
  123. len                         ds.w    1                ; offset: $0 (0)
  124. places                     ds.w    1                ; offset: $2 (2)
  125. flags                     ds.w    1                ; offset: $4 (4)
  126. sizeof                     EQU *                    ; size:   $6 (6)
  127.                         ENDR
  128. ColInfoArray            RECORD 0
  129. elements                 ds.b    256 * DBColInfoRecord.sizeof
  130. sizeof                     EQU *                    ; size:   $600 (1536)
  131.                         ENDR
  132.  
  133.  
  134. ;  structure of results returned by DBGetResults 
  135. ResultsRecord            RECORD 0
  136. numRows                     ds.w    1                ; offset: $0 (0)        ;  number of rows in result 
  137. numCols                     ds.w    1                ; offset: $2 (2)        ;  number of columns per row 
  138. colTypes                 ds.l    1                ; offset: $4 (4)        ;  data type array 
  139. colData                     ds.l    1                ; offset: $8 (8)        ;  actual results 
  140. colInfo                     ds.l    1                ; offset: $C (12)        ;  DBColInfoRecord array 
  141. sizeof                     EQU *                    ; size:   $10 (16)
  142.                         ENDR
  143.  
  144.                                                             ; messages sent to a 'ddev'
  145. kDBInit                            EQU        0
  146. kDBEnd                            EQU        1
  147. kDBGetConnInfo                    EQU        2
  148. kDBGetSessionNum                EQU        3
  149. kDBSend                            EQU        4
  150. kDBSendItem                        EQU        5
  151. kDBExec                            EQU        6
  152. kDBState                        EQU        7
  153. kDBGetErr                        EQU        8
  154. kDBBreak                        EQU        9
  155. kDBGetItem                        EQU        10
  156. kDBUngetItem                    EQU        11
  157. kDBKill                            EQU        12
  158. kDBOpen                            EQU        100
  159. kDBClose                        EQU        101
  160. kDBIdle                            EQU        102
  161. ;
  162. ; pascal OSErr InitDBPack(void )
  163. ;
  164.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  165.         Macro
  166.         _InitDBPack
  167.             move.w              #$0004,-(sp)
  168.             move.w              #$0100,D0
  169.             dc.w                $A82F
  170.         EndM
  171.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  172.         IMPORT_CFM_FUNCTION InitDBPack
  173.     ENDIF
  174.  
  175. ;
  176. ; pascal OSErr DBInit(long *sessID, ConstStr63Param ddevName, ConstStr255Param host, ConstStr255Param user, ConstStr255Param passwd, ConstStr255Param connStr, DBAsyncParmBlkPtr asyncPB)
  177. ;
  178.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  179.         Macro
  180.         _DBInit
  181.             move.w              #$0E02,D0
  182.             dc.w                $A82F
  183.         EndM
  184.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION DBInit
  186.     ENDIF
  187.  
  188. ;
  189. ; pascal OSErr DBEnd(long sessID, DBAsyncParmBlkPtr asyncPB)
  190. ;
  191.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  192.         Macro
  193.         _DBEnd
  194.             move.w              #$0403,D0
  195.             dc.w                $A82F
  196.         EndM
  197.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  198.         IMPORT_CFM_FUNCTION DBEnd
  199.     ENDIF
  200.  
  201. ;
  202. ; pascal OSErr DBGetConnInfo(long sessID, short sessNum, long *returnedID, long *version, Str63 ddevName, Str255 host, Str255 user, Str255 network, Str255 connStr, long *start, OSErr *state, DBAsyncParmBlkPtr asyncPB)
  203. ;
  204.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  205.         Macro
  206.         _DBGetConnInfo
  207.             move.w              #$1704,D0
  208.             dc.w                $A82F
  209.         EndM
  210.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  211.         IMPORT_CFM_FUNCTION DBGetConnInfo
  212.     ENDIF
  213.  
  214. ;
  215. ; pascal OSErr DBGetSessionNum(long sessID, short *sessNum, DBAsyncParmBlkPtr asyncPB)
  216. ;
  217.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  218.         Macro
  219.         _DBGetSessionNum
  220.             move.w              #$0605,D0
  221.             dc.w                $A82F
  222.         EndM
  223.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  224.         IMPORT_CFM_FUNCTION DBGetSessionNum
  225.     ENDIF
  226.  
  227. ;
  228. ; pascal OSErr DBSend(long sessID, Ptr text, short len, DBAsyncParmBlkPtr asyncPB)
  229. ;
  230.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  231.         Macro
  232.         _DBSend
  233.             move.w              #$0706,D0
  234.             dc.w                $A82F
  235.         EndM
  236.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  237.         IMPORT_CFM_FUNCTION DBSend
  238.     ENDIF
  239.  
  240. ;
  241. ; pascal OSErr DBSendItem(long sessID, DBType dataType, short len, short places, short flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  242. ;
  243.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  244.         Macro
  245.         _DBSendItem
  246.             move.w              #$0B07,D0
  247.             dc.w                $A82F
  248.         EndM
  249.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  250.         IMPORT_CFM_FUNCTION DBSendItem
  251.     ENDIF
  252.  
  253. ;
  254. ; pascal OSErr DBExec(long sessID, DBAsyncParmBlkPtr asyncPB)
  255. ;
  256.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  257.         Macro
  258.         _DBExec
  259.             move.w              #$0408,D0
  260.             dc.w                $A82F
  261.         EndM
  262.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  263.         IMPORT_CFM_FUNCTION DBExec
  264.     ENDIF
  265.  
  266. ;
  267. ; pascal OSErr DBState(long sessID, DBAsyncParmBlkPtr asyncPB)
  268. ;
  269.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  270.         Macro
  271.         _DBState
  272.             move.w              #$0409,D0
  273.             dc.w                $A82F
  274.         EndM
  275.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  276.         IMPORT_CFM_FUNCTION DBState
  277.     ENDIF
  278.  
  279. ;
  280. ; pascal OSErr DBGetErr(long sessID, long *err1, long *err2, Str255 item1, Str255 item2, Str255 errorMsg, DBAsyncParmBlkPtr asyncPB)
  281. ;
  282.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  283.         Macro
  284.         _DBGetErr
  285.             move.w              #$0E0A,D0
  286.             dc.w                $A82F
  287.         EndM
  288.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  289.         IMPORT_CFM_FUNCTION DBGetErr
  290.     ENDIF
  291.  
  292. ;
  293. ; pascal OSErr DBBreak(long sessID, Boolean abort, DBAsyncParmBlkPtr asyncPB)
  294. ;
  295.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  296.         Macro
  297.         _DBBreak
  298.             move.w              #$050B,D0
  299.             dc.w                $A82F
  300.         EndM
  301.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  302.         IMPORT_CFM_FUNCTION DBBreak
  303.     ENDIF
  304.  
  305. ;
  306. ; pascal OSErr DBGetItem(long sessID, long timeout, DBType *dataType, short *len, short *places, short *flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  307. ;
  308.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  309.         Macro
  310.         _DBGetItem
  311.             move.w              #$100C,D0
  312.             dc.w                $A82F
  313.         EndM
  314.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  315.         IMPORT_CFM_FUNCTION DBGetItem
  316.     ENDIF
  317.  
  318. ;
  319. ; pascal OSErr DBUnGetItem(long sessID, DBAsyncParmBlkPtr asyncPB)
  320. ;
  321.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  322.         Macro
  323.         _DBUnGetItem
  324.             move.w              #$040D,D0
  325.             dc.w                $A82F
  326.         EndM
  327.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  328.         IMPORT_CFM_FUNCTION DBUnGetItem
  329.     ENDIF
  330.  
  331. ;
  332. ; pascal OSErr DBKill(DBAsyncParmBlkPtr asyncPB)
  333. ;
  334.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  335.         Macro
  336.         _DBKill
  337.             move.w              #$020E,D0
  338.             dc.w                $A82F
  339.         EndM
  340.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  341.         IMPORT_CFM_FUNCTION DBKill
  342.     ENDIF
  343.  
  344. ;
  345. ; pascal OSErr DBGetNewQuery(short queryID, QueryHandle *query)
  346. ;
  347.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  348.         Macro
  349.         _DBGetNewQuery
  350.             move.w              #$030F,D0
  351.             dc.w                $A82F
  352.         EndM
  353.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  354.         IMPORT_CFM_FUNCTION DBGetNewQuery
  355.     ENDIF
  356.  
  357. ;
  358. ; pascal OSErr DBDisposeQuery(QueryHandle query)
  359. ;
  360.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  361.         Macro
  362.         _DBDisposeQuery
  363.             move.w              #$0210,D0
  364.             dc.w                $A82F
  365.         EndM
  366.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  367.         IMPORT_CFM_FUNCTION DBDisposeQuery
  368.     ENDIF
  369.  
  370. ;
  371. ; pascal OSErr DBStartQuery(long *sessID, QueryHandle query, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  372. ;
  373.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  374.         Macro
  375.         _DBStartQuery
  376.             move.w              #$0811,D0
  377.             dc.w                $A82F
  378.         EndM
  379.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  380.         IMPORT_CFM_FUNCTION DBStartQuery
  381.     ENDIF
  382.  
  383. ;
  384. ; pascal OSErr DBGetQueryResults(long sessID, ResultsRecord *results, long timeout, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  385. ;
  386.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  387.         Macro
  388.         _DBGetQueryResults
  389.             move.w              #$0A12,D0
  390.             dc.w                $A82F
  391.         EndM
  392.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  393.         IMPORT_CFM_FUNCTION DBGetQueryResults
  394.     ENDIF
  395.  
  396. ;
  397. ; pascal OSErr DBResultsToText(ResultsRecord *results, Handle *theText)
  398. ;
  399.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  400.         Macro
  401.         _DBResultsToText
  402.             move.w              #$0413,D0
  403.             dc.w                $A82F
  404.         EndM
  405.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  406.         IMPORT_CFM_FUNCTION DBResultsToText
  407.     ENDIF
  408.  
  409. ;
  410. ; pascal OSErr DBInstallResultHandler(DBType dataType, DBResultHandlerUPP theHandler, Boolean isSysHandler)
  411. ;
  412.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  413.         Macro
  414.         _DBInstallResultHandler
  415.             move.w              #$0514,D0
  416.             dc.w                $A82F
  417.         EndM
  418.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  419.         IMPORT_CFM_FUNCTION DBInstallResultHandler
  420.     ENDIF
  421.  
  422. ;
  423. ; pascal OSErr DBRemoveResultHandler(DBType dataType)
  424. ;
  425.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  426.         Macro
  427.         _DBRemoveResultHandler
  428.             move.w              #$0215,D0
  429.             dc.w                $A82F
  430.         EndM
  431.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  432.         IMPORT_CFM_FUNCTION DBRemoveResultHandler
  433.     ENDIF
  434.  
  435. ;
  436. ; pascal OSErr DBGetResultHandler(DBType dataType, DBResultHandlerUPP *theHandler, Boolean getSysHandler)
  437. ;
  438.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  439.         Macro
  440.         _DBGetResultHandler
  441.             move.w              #$0516,D0
  442.             dc.w                $A82F
  443.         EndM
  444.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  445.         IMPORT_CFM_FUNCTION DBGetResultHandler
  446.     ENDIF
  447.  
  448. ;
  449. ; pascal OSErr DBIdle(void )
  450. ;
  451.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  452.         Macro
  453.         _DBIdle
  454.             move.w              #$00FF,D0
  455.             dc.w                $A82F
  456.         EndM
  457.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  458.         IMPORT_CFM_FUNCTION DBIdle
  459.     ENDIF
  460.  
  461.  
  462.  
  463.     ENDIF ; __DATABASEACCESS__ 
  464.  
  465.